OwnableValidator Smart Contract Documentation
Overview
The OwnableValidator is a Solidity smart contract that implements a multi-signature validation mechanism for Ethereum accounts. It allows accounts to designate multiple owners and define a threshold of signatures required to validate transactions or messages.
Key Features
- Multi-signature Support: Multiple owners can be assigned to an account
- Configurable Threshold: Users can set how many signatures are required for validation
- Owner Management: Functionality to add and remove owners
- ERC-4337 Compatible: Supports validation for UserOperations
- ERC-1271 Support: Implements signature validation standard
Core Concepts
Initialization
- Users can initialize the module by providing:
- A threshold (number of required signatures)
- A list of owner addresses
- Maximum of 32 owners per account
Validation Mechanisms
The contract provides three types of validation:
- UserOperation validation (ERC-4337)
- ERC-1271 signature validation
- Stateless signature validation with provided configuration
Owner Management
- Owners can be added and removed
- The number of owners must always be greater than or equal to the threshold
- Owner addresses are stored in a sorted, unique list
Security Features
- Ensures owners are unique and sorted
- Prevents removal of owners if it would make the threshold unreachable
- Validates signature uniqueness during checks
- Uses a sentinel list for efficient owner management
Key Limitations
- Maximum of 32 owners per account
- Threshold must be greater than zero
- Cannot remove owners if it would make the threshold impossible to reach
Events
ModuleInitialized: Emitted when the module is installedModuleUninitialized: Emitted when the module is uninstalledThresholdSet: Emitted when the signature threshold is changedOwnerAdded: Emitted when a new owner is addedOwnerRemoved: Emitted when an owner is removed